package com.ht.pms.core.job;

import com.ht.pms.core.controller.user.SalaryUserController;
import com.ht.ussp.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class UcSynchronizeJob {

    private static final Logger LOG = LoggerFactory.getLogger(UcSynchronizeJob.class);

    @Autowired
    private SalaryUserController salaryUserController;


    @Scheduled(cron = "0 0 1 9 * ?")
    public void synUcUserInfo(){

        String startTime = DateUtil.formatDate(DateUtil.addMonth2Date(-1,DateUtil.getNow()));
        LOG.info("======同步uc用户信息定时任务开始,同步开始时间【{}】",startTime);

        try {
            salaryUserController.updateUserInfo(startTime,"");
        } catch (Exception e) {
            e.printStackTrace();
        }
        LOG.info("同步uc用户信息定时任务结束========");
    }

}
